if MsgBox('Script.DeInitializeSetup:' #13#13 'The [Code] scripting demo has finished. Do you want to uninstall My Program now?', mbConfirmation, MB_YESNO) = idYes then begin
FileName := ExpandConstant('{uninstallexe}');
if not InstShellExec(FileName, '', '', SW_SHOWNORMAL, ErrorCode) then
if MsgBox('Script.NextButtonClick:' #13#13 'Using the script, files can now be extracted before the installation starts. For example we could extract ''MyProg.exe'' now and run it.' #13#13 'Do you want to do this?', mbConfirmation, MB_YESNO) = idYes then begin
if ExtractTemporaryFile('myprog.exe') then begin
if not InstExec(ExpandConstant('{tmp}\myprog.exe'), '', '', True, False, SW_SHOWNORMAL, ErrorCode) then
MsgBox('Script.NextButtonClick:' #13#13 'The file could not be executed. ' + SysErrorMessage(ErrorCode) + '.', mbError, MB_OK);
end else
MsgBox('Script.NextButtonClick:' #13#13 'The file could not be extracted.', mbError, MB_OK);
end;
BringToFrontAndRestore();
MsgBox('Script.NextButtonClick:' #13#13 'The normal installation will now start.', mbInformation, MB_OK);
end;
end;
Result := True;
end;
function SkipCurPage(CurPage: Integer): Boolean;
begin
case CurPage of
wpInfoBefore:
Result := MsgBox('Script.SkipCurPage:' #13#13 'Do you want to skip the ''InfoBefore'' page?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = idYes;
else
Result := False;
end;
end;
procedure CurPageChanged(CurPage: Integer);
begin
case CurPage of
wpWelcome:
MsgBox('Script.CurPageChanged:' #13#13 'Welcome to the [Code] scripting demo. This demo will show you some possibilities of the new scripting support.' #13#13 'The scripting engine used is Innerfuse Pascal Script by Carlo Kok from Innerfuse. See http://www.carlo-kok.com/ifps3.php for more information.', mbInformation, MB_OK);
wpFinished:
MsgBox('Script.CurPageChanged:' #13#13 'Welcome to final page of this demo. Click Finish to exit.', mbInformation, MB_OK);
end;
end;
function MyProgCheck(): Boolean;
begin
if not MyProgChecked then begin
MyProgCheckResult := MsgBox('Script.MyProg:' #13#13 'Do you want to install MyProg.exe and MyProg.hlp?', mbConfirmation, MB_YESNO) = idYes;